<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>

<style>
@font-face {
  font-family: 'ahem';
  src: url(../../resources/Ahem.ttf);
}
</style>

<script>

promise_test(() => {
  return document.fonts.load("12px ahem").then(() => {
    let cssText = "@font-face { font-family: 'Courier New'; src: local('Courier New') }";
    let cssNode = document.createElement('style');
    cssNode.type = 'text/css';
    let head = document.getElementsByTagName('head')[0];
    head.appendChild(cssNode);
    let cssTextNode = document.createTextNode(cssText);
    cssNode.appendChild(cssTextNode);

  });
}, 'Checks that adding CSS in callback of fonts.loadFont() does not ' +
    'cause a crash.');

</script>
